Some states have rules about shooting a loose dog doing livestock damage. The only person here in Michigan allowed that process is a sheriff deputy/DNR officer.
You can go to jail or pay a fine or both if you take that action.
Know the laws first then proceed accordingly.