It depends on how you deal damage1
The calculations are for level 8, ability is 20 with ASI, 16 without it. The target AC is 16, as usual for a CR8 monster.
Ability bonus to attack and damage
The list is short for cantrips; Warlocks with Agonizing Blast, Evokers and Dragon Sorcerers, Clerics with Potent Spellcasting. Weapon attacks also belong here:
20: +8 attack bonus, 65% hit chance. Damage for a Warlock is 2d10+10=21. DPR is 13.65.
16: +6 attack bonus, 55% hit chance. Damage is 2d10+6=17. DPR is 9.35, 46% lower.
For a Dragon Sorcerer the difference is smaller 35%, as he only adds the Charisma bonus to the damage once. Still, the difference is huge. Higher for Clerics, as Sacred Flame has smaller base damage.
As higher level spells are more powerful to begin with, your ability modifier makes less of a difference.
Ability bonus to attack, or save for no damage
Most damaging cantrips fall into this category, except for the combinations mentioned in the previous section. Disintegrate comes to mind from higher levels.
20: +8 attack bonus, 65% hit chance. Damage for a Diviner with Fire Bolt is 2d10=11. DPR is 7.15.
16: +6 attack bonus, 55% hit chance. Damage is the same, DPR is 6.05, 18% lower.
This is about the half of a Dragon Sorcerer's or Evoker's difference.
This category is closest in behavior to non-damaging, single save spells like Faerie Fire or Suggestion.
Ability bonus to DC, save for half damage
Most damaging spells above level 2 belong here.
20: DC16, 65% hit chance2, 28 damage with Fireball, 14 with a successful save. DPR is 23.1.
16: DC14, 55% hit chance2, DPR is 21.7, not even 7% difference.
Abilities do not matter
For completeness sake, Magic Missile is mentioned; your ability scores have no impact. Very rare, quite weak for offense3.
Except for Evokers, for whom it is probably the best damaging spell ever.
How this affects the game
If you are a weapon user or Warlock, not taking an ASI is close to crippling.
In the 20 level long career of a Fighter for example, there are only three class features that bring a bigger improvement to your combat effectiveness: Extra Attack 1, 2 and 3.
On the other end of the spectrum, an Evoker of level 6 deals half damage with cantrips even if the target saves successfully, meaning that your abilities matter even less. The difference between Int 16 and 18 is around 3%, invisible in practice.
This also means that if for some reason you have low abilities overall, a bit counter-intuitively a Blaster is your least bad option.
Most non-damaging spells are between these extremes. You can get by with a 16 in most encounters, unless it has a single target. Than increasing the chance of a failed save is your highest priority.
Of course it will always sting to know that the dragon would have failed that save against Disintegrate if your Cha were 2 points higher
1 There are other ways to be relevant in combat, but they are nearly impossible to quantify)
2 For spells with saves I will assume the same hit chance, otherwise it would be very hard to calculate, as different monsters have different strong saves
3 Unless you are an Evoker with Magic Missile, which is brokenly powerful, and should have been errataed years ago