Check
Porygon2 @ Eviolite
Ability: Trace
EVs: 252 HP / 252 Def / 4 SpD
Bold Nature
- Thunderbolt
- Ice Beam
- Recover
- Thunder Wave
A lot of the obvious stuff that beats Excadrill has been stated already, so here's something a little out of left field. Defensive Porygon2 can take pretty much anything Excadrill throws at it, being 3HKOed at worst by its moves. It does meh damage back, but between stalling for Life Orb recoil damage with Recover and chip damage with Ice Beam, eventually you'll wear down Excadrill (or stall out the sand, making Excadrill much less threatening). As an added bonus, copying Sand Rush with Trace makes you take no damage from sandstorm, increasing your ability to tank hits.
Calcs
252+ Atk Life Orb Excadrill Earthquake vs. 252 HP / 252+ Def Eviolite Porygon2: 125-148 (33.4 - 39.5%) -- guaranteed 3HKO
252+ Atk Life Orb Excadrill Iron Head vs. 252 HP / 252+ Def Eviolite Porygon2: 99-118 (26.4 - 31.5%) -- guaranteed 4HKO
0 SpA Porygon2 Ice Beam vs. 0 HP / 0 SpD Excadrill: 96-114 (26.5 - 31.5%) -- guaranteed 4HKO
Porygon2 can also run HP Fire over Thunder Wave to deal with Excadrill a bit better, but it honestly doesn't really up your damage too much (turns your 4HKO into a 3HKO) so it's probably not worth running over Thunder Wave unless you really have problems with Scizor and Ferrothorn. You also should probably have some sort of backup plan when dealing with Excadrill, since Porygon2 is not a super hard check, due to the fact that you can be haxed to death by Iron Head. If you come in on an Earthquake, then get flinched by an Iron Head, the next Earthquake has a decent chance of fainting you. But in any other situation, you should be fine.