I'm aware of people who decouple the "cast a spell" step from the "announce the spell" step, and implement rules to identify which spells are being cast ahead of time. I think it slows the game down too much for my liking, but that's an option.
To make Counterspell more fair and give it a degree of interaction, I run counterspell as a contested check (d20 + spellcasting modifier + level of the spell/counterspell). It gives players an active role in the outcome, and it feels less cheap when the NPC negates their spell.