When a counterspell targets your spell, both the counterspell and your spell are on the stack. You can respond by casting Veil of Summer. The stack now has (from top): Veil of Summer, then the counterspell, then your original spell.
Veil of Summer resolves first. It gives your spells and permanents hexproof from blue and from black until end of turn (CR 702.11 covers hexproof). Crucially, it also draws you a card if an opponent has cast a blue or black spell this turn — the counterspell itself satisfies this condition.
Now the counterspell tries to resolve. It targets your spell, but your spell now has hexproof from blue (or black, depending on the counterspell's color). Hexproof means that spell 'can't be the target of spells or abilities your opponents control' of the relevant color (CR 702.11b). Since the target is now illegal, the counterspell has no legal targets and is countered by the rules of the game for having an illegal target upon resolution (CR 608.2b).
Concrete example: You cast Collected Company. Your opponent responds with Counterspell (blue). You respond with Veil of Summer. Veil resolves, granting your spells hexproof from blue and drawing you a card. Counterspell then tries to resolve but finds its target (Collected Company) now has hexproof from blue — the target is illegal, so Counterspell is countered by game rules, and Collected Company resolves normally.
Note: This only works if the counterspell is blue or black, since Veil of Summer only grants hexproof from those colors. A red or white counterspell (e.g., Absorb's countering effect isn't the issue — but a pure non-blue/black counter) would not be stopped this way.
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.