If a particular animal is acting as a pest that is destroying the livelihood of human beings, it is not outside the realm of morality to consider removing that threat to human livelihood by killing the animal pest. But a dog is a higher “order” of animal, so to speak, than an insect or rodent (the most common forms of vermin animals). Killing a dog to protect sheep and goats should be the absolute last resort to protecting one’s livestock. And keep in mind that you would not be killing the dog to protect the sheep, but killing an animal to defend a human family’s means of supporting themselves through the raising of livestock.
If at all possible, every effort should be made to protect livestock through non-lethal means, particularly if the dogs in question are not wild dogs but tame dogs. It would be particularly objectionable if the dogs in question were the pets of another human family. In that case, the situation should be referred to the dog owners for a peaceful resolution.
As a side note, dogs do not have the use of reason. The poisoning of a pack mate is not going to have another dog in its pack thinking, “Hmm, I guess I better leave alone Farmer John’s sheep or I’ll end up dead like our Alpha.”