I don't use BB guns on pups. And by the time you get a hose and turn the water on, an unwelcome visiting dog will have done what it came to do. Get a stiffer backbone.
It's not a matter of backbone. What you are doing is just plain cruel.
Just yell and run the dog off.