It needs to be consistent, which means it needs to be enforced even when you’re not around. Try an automatic sensor tool like SSSCAT. DO NOT use anything like a spray bottle, especially wielding it yourself. You don’t want to associate punishment with yourself.
As the Cat Daddy, Jackson Galaxy likes to say that you ought to supply a “yes” with every “no”, which I agree with. Kitty can’t sit on the table? Give her a place to sit. Try a high stool or cat tree in the area that’s hers. This is where the treats come in: reinforcing where you want her to be.
I highly recommend watching the Cat Daddy videos.