The squirt gun will quite quickly teach the cat not to spray while you are there and have the squirt gun. It will not preclude the cat's coming back when you - or the squirter - are not around, and doing his "mark" just to prove it can get away with it. It most likely will not prevent the cat from checking to see if there's water in the squirter, and then doing it right there in front of you if you've let the thing run dry.
No cat will ever believe that anything a cat does is "wrong." If you squirt him, he'll leave to avoid being squirted. He may avoid coming back to where he got wet as long as you're there to do it again - and he will know that you were responsible and will punish you for it; but there is no way he'll associate being squirted with anything he did or might have done. Cat's are perfect, and entitled (according to one or two who have explained this to me).