You can try avoidance training with a shock collar but who knows if it will work. In the parts of the US, hunters use avoidance training on dogs for rattlesnakes and it works to a great degree (snake proofing). I've never heard of it being used for sheep.

Loose dogs in the southwest US who are in sheep country usually don't survive too long. If the ranchers or drivers don't kill them, the predators (usually coyotes but occasionally mountain lions) will.