Question: how to train your dog not to pee when scared?
Answer: Avoid direct eye contact, approach your dog from the side, and crouch down to your dog's level.
When petting your puppy, go for under the chin rather than the top of the head.
Keep all greetings low key and take your dog outside to relieve itself as soon as you get home.