With respect, Small Farmer, your dog has been mistrained, as I think you mentioned earlier. That dog has been maltreated. No place for using an e-collar in that way.
That is a different type of collar form what is being mooted by Bangbang. However, I also know that something similar to what he suggests was used by friends of mine, Pete and Margaret, some years ago(1990s) for both sheep and dogs, when they bought their farm to build up a quarantine business.
Their yard was unfenced when they moved in and needed some protection for their dogs. Pete bought a roll of cable, buried it in a circle around the yard under the grass, and placed a few fence posts along the line with a single wire between them to indicate where the fence was. The two dogs had sensors attached to their collars which gave out a loud warning noise (no shock) when they went near the 'invisible' fence. They learned very quickly to stay away from it, even without the collars on, and he even took the post and wire fence down.
He then bought some Jacob sheep and decided to 'strip' graze them using the same method. And it worked using the lead male and lead female
What impressed me was that when they got some more dogs they didn't need to move the cable back to the yard or put sensors on the new dogs - they seemed to learn from the original two setters to stay at least a yard away from the edge of the grass where the buried cable had been - even when friends came to visit.
What I found even more impressive was that the Jacobs learnt to recall to Pete's piercing whistle.

One whistle adn they came running!

Never knew a man quite like him.

And yes, I think they may have been banned in Wales but not yet in England or Scotland, not sure about Northern Ireland.