You need to make sheep either boring or taboo.
We have a range of dogs, terriers, lurchers, whippet, hounds, collie, spaniel etc etc. All working, and the runners are terriers are well versed in chasing things. . . . . .
But all of them are out from when they have had their jabs, just walking past, through, round sheep etc etc, until sheep are just a boring part of the scenery.
Some, however, take a little more correction, i've had a couple of dogs made an error of judgement, and in a moment of haste, pile into a sheep (mostly when a lone sheep has jumped out of a block of cover, looking very much like something else!). The ONLY thing you can do then, is to very quickly and very firmly correct them, and I hate to say it, but several good whacks around the head and shoulders is probably the best method! I've had to do it twice over the last couple of years to different dogs, and both have immediately been returned to a field of sheep and were fine, and now will never even look in their direction!