Air-burst rounds beat trenches.
Armor piercing rounds beat tanks (and bunkers).
So the solution: have tanks next to your trenches. If your opponent loads air-burst rounds into their weapon, charge at them with your tank.
If your opponent loads armor-piercing rounds into their weapon, run into the trench. Armor-piercing (neither HEAT nor Sabot) can do much vs a trench. (I'm ignoring the AC-130, just assuming land-based combat for now cause AC-130 is beaten by a totally different strategy: air superiority)
---------
"Combined arms". Your opponent has to load his weapon with the right bullet for the right circumstance. Mix up your strategies (both defensive and offensive strategies).
* HEAT-armor piercing loses to reactive armor on a tank.
* Reactive-armor loses to sabot-rounds.
* Sabot rounds lose to long-distance battle (air-resistance slows down the round). HEAT is better at long-distance (HEAT always was kinda slow: most of the "power" comes from the explosion that occurs after-the-collision... which is beaten by reactive armor).
You can't guard against everything. Instead, you rely upon mixing up the strategies enough so that enemies are kept "guessing" as to which weapon to load / unload.