The best you can honestly expect is for them to get off the counter when you're in the room. You can encourage them not to be up on the counters, but you can't prevent it - not really.
Basics of counter training: (seems I'm in a list mood today, lol)
-Never keep ANYTHING that MIGHT be edible on the counters/stove area. (Pots/pans, bread, fruit, nothing! That's what microwaves are for
-Skip the punishment, as you mentioned it doesn't work.
-Give them a high-up place where they CAN go (stools, chairs, cupboards, etc.)
-Praise and reward them for choosing the acceptable place, and if you catch them on the counter remove them to the floor or their acceptable place.
After that, it's all about consistency. The first time you forget and leave a chicken or roast unattended on the counter you've just taught them to ALWAYS check and see if yummy food will be there and you'll never get them off of it, lol.
As an added bonus I taught my kitties 'Up' and 'Off' - which I always teach as a set. Both are useful.
-Get some yummy treats, a stool or chair and ONE kitten! (don't try training with more than one at a time. It'll be a gong show! lol - if you do train them all at once I demand a video
-Show the kitten the treat and then hold it above the chair. They should jump up.
-Say "Yes!" (or click if you're using a clicker), then feed them the treat.
-Then, show another treat and throw it on the floor as you say "Off". Always use a happy voice!
-Repeat a bunch of times until the kitten clearly has the basics of this game, then take a step back and - with the kitten on the floor - move towards the stool and say "Up!" I also use a hand gesture as an added tip for the kitten. If they jump up to the stool say "Yes!" and reward them. If they don't just pause and let them think it through - it might take a second but most kittens will guess 'jump onto the stool?', reward.
If they don't jump on the stool but instead sit down and look confused try again, this time tossing the treat gently onto the top of the stool.
-With the kitten on the stool say "Off" and don't throw a treat this time, if they jump off, or think a second and then jump off say "Yes!" and give them the goody (This time the goal is for them to do the behavior without the lure of seeing the food BEFORE the jump. It's a big step!)
Repeat a bunch of times until the kitten is doing up and off with no hesitation - without seeing the food first. Then move the stool or chair a few inches and start over. You'll move through the steps quicker, but start right from step one. Moving the stool can confuse the kitten, so you have to begin again.
Repeat this, moving the stool all over your home, over the course of many days, until they clearly 'get it'. Then you've got two ways to go: you can teach 'wait' and you can expand the up and off cues to other surfaces and areas.
To teach wait you ask the kitten to 'up' then pause a few seconds (not staring at the kitten!) before rewarding. If they choose to stay on the stool longer reward every 30 seconds or so. After a few treats ask for an 'off', then reward. Repeat over and over, varying the wait time, until the kitten will patiently sit while you move around and do other things.
I'm doing a refresher on this with Muffin atm, he's getting a bit of spring fever (awfully early, since we're only 1/2 through winter here), so we're going to get his 'wait' and 'place' (go to the stool) back to the point where he'll chill out there rather than be a pain. It's slow, but steady and the extra brain work wears out his naughtiness pretty quick.
To expand up and off to other surfaces you just repeat the same procedure, but with other chairs, counters etc. I do practice with my counters, mostly only rewarding after the 'off' (1 reward about 1 'up' for every 3-4 'offs') because I want them jumping down from the counter to be way more fun than jumping up onto it.
As an added bonus this makes picture taking easier, and it's something you can do at the vets while waiting to see the vet. Doing things they know when they're in unfamiliar areas will encourage them to feel more comfortable and confident.