My dog used to be a horrible counter surfer.
She's gotten better, but will still occasionally put her paws up there when we're not looking if she thinks she smells something. Once when my sister was visiting she's not accustomed to dogs and left a stick of butter on the counter - my dog grabbed it. Fortunately she's learning "drop it" and "leave it".
I don't keep anything enticing in her reach, and keep the counters clean. I've also read to leave a pan that will tip on the counter (so the noise will deter them), but I never tried that.