I've heard burying their own stool in the area deters them from digging in that specific spot, never tried though.
Whenever Maverick would dig in the backyard I would spray him with a squirt gun and give a firm "leave it". If it didn't register by the 3rd shot, he would go timeout. He does dig a little bit at the park, but he got over that phase within a matter of days.
Others may have better suggestions, but that's what worked for us.