THere are a lot of old wives tales about dogs and sheep.
Putting a dog in a pen with a ram or ornery sheep will generally do one thing.
Confirm to the dog that sheep are extremely dangerous and INCREASE its desire to rid the world of them.
No dog should be off lead amongst sheep (or other livestock) unless it has been proofed against them and then only when absolutely necessary. (unless it is working them of course)
Even if dogs are safe with sheep in a field, do not take it for granted that this will cover moorland sheep etc. They smell different and move in different ways and one popping up whilst out on a walk constitutes sudden environmental contrast (SEC) and can trigger a chase response.
In addition not all dogs view sheep in the same way, some are just chasers but some will kill, and thus advice has to be tailored to the individual dog in question.
For more information see here.
Angela Stockdale, Dog Aggression Specialist - Living with Livestock: dogs with stock problems
As well as Angela various other people conduct livestock training sessions.
Including Sue Harper
Dog Training Events - Association of Pet Dog Trainers UK
Your dog is at risk of being shot if found at large with livestock.