I've never cared for that and have negotiated with my cats to not do this (generally carried out with a spray bottle). My most recent cat recognized the concept well enough that when I moved to new places (which happened with some regularity) he recognized the concept of "kitchen counter" as "place I'm not allowed". Similarly dining room table, though he was allowed on my desk.
Of course, in actuality the cat possibly learned to not be on the counter or table around you. What they do when you're not around or sleeping is an entirely other question.