There are a few reasons why your dog may be counter-surfing right now. Though it's not the most troublesome of behaviours, it can be an indicator of some common issues that we can easily prevent and manage so that dinner time is enjoyable for all!
Let's start with your dog's feeding habits/rituals. If they're not into their food, they may be counter-surfing or even begging for other food because it's a means to eating something they prefer. You can read this article if your dog isn't into their food. If your dog does eat his food but would rather try to get to the food you're having or anything that's being left on the counter, one way that you can help manage the environment to help them keep all four on the ground is to provide them with food puzzles or snuffle mats that'll further engage their attention. Tried the above and your dog is still counter-surfing? Consider the following: 1. Is your dog feeling bored/does feeding time = getting attention time? Counter-surfing, begging or whining can be signs that your dog has found in those activities a little bit of a 'problem' or a game to take on if they're feeling bored or understimulated. It can also be something they practice when they're too tired and don't know how to rest (see the second point for more details) on their own.
And so what you will want to do is plan accordingly, to set yourself and your dog up for success by doing physically, mentally and even socially-stimulating activities not too long before lunchtime or dinner time, to help your dog feel more mellow and relaxed. A dog that's feeling more mellow is one that's more receptive to training or receiving your guidance, as opposed to one that is feeling very energetic, and simply looking for some engaging outlets to put that energy towards!
2. Provide your dog with an alternative.
If your dog doesn't know what to do, simply confronting and telling them to not jump or counter-surf will likely not work. Instead, you will want to provide your dog with an alternative that feels just as good, or even better, for them to practice instead of counter surfing. If you've practiced the first point above, then it should be doable to guide your dog with their leash towards their bed, wait for them to lay down and reward them with a special treat before dinner time, as to let them know that they have something they can do on their own end WHILE you focus on dinner.
Each dog will respond to this differently. Dogs that have learned this type of relaxation exercise in class may have an easier time staying in that position/feeling on their own. If your dog keeps getting up you will want to gently guide them back to their bed. With enough practice and repetition, your dog will learn that what you're asking of them is to wait on it (and ensure it pays off with a high-value reward, especially the first times you try this.). If your dog has a really hard time staying away from you and the action, you may need to consider the point below as well.
3. If being away and giving you distance is something that's very difficult for your dog, then it's going to take some time. While your dog is learning that it's enjoyable and rewarding to give you space during dinner time, you will still want to ensure that you're preventing counter-surfing altogether. Because even if your dog isn't yet doing the behaviour you want (waiting elsewhere while you eat) you want to make sure that you practice making it so they can't practice the unwanted behaviour. And you can do so by assigning a member of your household that will help walk your dog away as he gets closer to the table or kitchen area.
Walking away ensures that your dog doesn't get to jump or counter-surf and it's eventually the action that you will want your dog to do all on their own (especially if it's difficult for them to simply stay and wait somewhere else) so be sure to make it fun and rewarding for them to walk away from the table with you. Simply repeating this exercise of walking, in combination with the first two points will create for a little bit of an exercise that burns any extra mental or physical energy your dog may have, which can then encourage them to naturally want to take a break and not feel the need to counter-surf.