Just hit him with superior facts and knowledge about the position. They get humbled on the spot. Know your traps and do the lessons here on chess.com.
How do you punish the opponent deviating from theory?

Its hunter vs trapper. Sometimes the aggressive hunter player needs to adjust and become a slower trapper. Very aggressive lines have a larger risk/reward element. Try to understand is your opponent playing to win or not lose then adjust accordingly.
Recently, I've been trying to play more aggressive lines as white but have been unable to execute my aggressive ideas once the opponent deviates from theory. Are there any courses you might recommend to maximize the activity of your pieces?