Praise be to Allah.
It is by the mercy of Allah, may He be exalted, to His slaves that He has created for them what is in the heavens and on earth, and He has subjugated it in their interests, for their livelihood. Included in that is the fact that He has prescribed for them to ward off harm and aggression from themselves and their property or wealth, even if that leads to killing the aggressor or the one who is causing harm to them, such as wolves or other predators. But with regard to animals that do not cause harm, it is not permissible to kill them.
See: al-Mughni, by Ibn Qudaamah, 4/324
Dogs are of two types: those which it is Sunnah to kill and those which are not to be killed. As for those which it is Sunnah to kill, it is the black dog because it is a devil, and the vicious dog because it is harmful. All other dogs are not to be killed.
If these dogs are attacking the sheep and killing and eating some of them, then these are harmful dogs whose harm is to be warded off even if that is by killing them; rather they should be killed because of the mischief that they are causing. Al-Bukhaari (1829) and Muslim (1198) narrated that ‘Aa’ishah (may Allah be pleased with her) said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “There are four (creatures), all of which are vermin and may be killed inside the sanctuary and outside: kites, crows, rats and vicious dogs.”
The scholars of the Standing Committee said:
With regard to dogs that are harmful because they are vicious or are predators or have rabies, and other kinds of aggression and fearful matters, there is nothing wrong with killing them in ways that do not cause harm to others that are not harmful. End quote from Fataawa al-Lajnah al-Daa’imah, 26/201
The scholars of the Committee were asked:
One day I caught a dog that had attacked one of the sheep but not killed it, and I killed this dog. Please note that I do not know who this flock belonged to; I carried the sheep and put it in a fenced area nearby and left it there.
If the situation was as you describe, then what you did was good and there is no blame on you, because you saved the property of your Muslim brother from being destroyed and you will be rewarded for that, in sha Allah.
End quote from Fataawa al-Lajnah al-Daa’imah, 26/205
There is no doubt that it is worthwhile for the owner of the sheep to appoint someone to guard them or a shepherd to look after them, but that does not mean that it is not prescribed to kill these dogs, because they have got used to attacking and if they fail to catch one thing they will look for something else and attack it. Hence it is prescribed to kill them.
So these dogs are to be killed and the owner of the sheep should be instructed to look after them and protect them.
And Allah knows best.