That's a tough habit to break . Digging comes naturally to dogs . Your best bet is to give them something else to occupy their time while in the yard . Toys of some sort such as a "Kong" with a treat in them so he will have to work to get it out . You just have to redirect their attention onto something else . I put all natural peanut butter in my dog's kongs , freeze them and let them play with those . They will work for a long time to get at the peanut butter .
My dogs dig a lot . I have curbed it somewhat by watching them through the window and when I catch them digging I will step outside and shake an empty pop can with pennies in it and tell them NO . The sudden noise draws their attention away from the digging and the NO let's them know that digging is not allowed . But it is hard to completely stop .