In most cases, dog training can assist, but putting a sandbox out may make it much more successful. In the event that you see your dog approaching the fence, order them away and guide him to the sandbox. Prepare a treat and some attention for him while you're there.