You add your spellcasting ability modifier only, with some notable exceptions.
make an ability check using your spellcasting ability.
The rules for ability checks state:
To make an ability check, roll a d20 and add the relevant ability modifier.
So the general rule is that we only add our spellcasting ability modifier to the d20 roll. But why don't we add our proficiency bonus?
The proficiency bonus is typically only added to an ability check when the check involves a particular skill. The rules for skills say (emphasis mine):
Sometimes, the DM might ask for an ability check using a specific skill — for example, “Make a Wisdom (Perception) check.” At other times, a player might ask the DM if proficiency in a particular skill applies to a check. In either case, proficiency in a skill means an individual can add his or her proficiency bonus to ability checks that involve that skill. Without proficiency in the skill, the individual makes a normal ability check.
Since the description of counterspell calls for an ability check, not a check involving a particular skill, the proficiency bonus does not apply, per the emphasized portion in the quote above.
Exceptions supersede general rules.
Dungeons & Dragons 5th Edition includes a rule that is sometimes expressed as specific beats general. This rule is explained in Xanathar's Guide to Everything and Tasha's Cauldron of Everything so:
The game also includes elements — class features, spells, magic items, monster abilities, and the like — that sometimes contradict a general rule. When an exception and a general rule disagree, the exception wins.
In light of this rule, we observe two notable exceptions to the general rule expressed in the first section.
The Bard's Jack of All Trades
At 2nd level, the Bard class receives the class feature Jack of All Trades, which says:
Starting at 2nd level, you can add half your proficiency bonus, rounded down, to any ability check you make that doesn’t already include your proficiency bonus.
As noted in the first section, we typically do not add our proficiency bonus to the ability check for counterspell, so this ability check qualifies for the bonus from Jack of All Trades, allowing a Bard to add half their proficiency bonus to the ability check of counterspell.
The Abjuration Wizard's Improved Abjuration
At 10th level, the Abjuration Wizard receives the class feature Improved Abjuration:
Beginning at 10th level, when you cast an abjuration spell that requires you to make an ability check as a part of casting that spell (as in counterspell and dispel magic), you add your proficiency bonus to that ability check.
So a 10th level (or higher) Abjuration Wizard can add their proficiency bonus to ability checks made for counterspell.
Any other feature that lets you modify an ability check.
We also see exceptions to the general rule in any feature that lets you modify an ability check.
At 14th the College of Lore Bard gets the feature Peerless Skill:
Starting at 14th level, when you make an ability check, you can expend one use of Bardic Inspiration. Roll a Bardic Inspiration die and add the number rolled to your ability check. You can choose to do so after you roll the die for the ability check, but before the DM tells you whether you succeed or fail.
At 14th level the bardic inspiration die is a d10, but becomes a d12 at 15th level.