I have a lock on my back fence that I used to have this trouble with. For a time I used de-icer, then I ran out of that and just heated the key with a lighter before inserting it into the lock.
This is a better solution: Make your lock a rubber hat. Get an old innertube or something similar and punch two holes for the shackle with an awl or punch. position the rubber around the lock so that it acts like an umbrella and directs the water away from the keyhole. Position the lock keyhole down.
Dan