Moves
Ice Beam is Porygon2's most important offensive tool, allowing it to check dangerous threats such as Garchomp, Mega Salamence, and Landorus-T. Be careful about Landorus-T though, as it has a habit of carrying Knock Off. Foul Play is Porygon2's other main offensive tool. When combined with Trace, it allows Porygon2 to check threats such as Mega Kangaskhan and Belly Drum Azumarill. Recover allows Porygon2 to have some serious staying power.
Thunder Wave is an excellent status move in Battle Spot Singles and is a good choice if your team has more problems with Porygon2's offensive checks. Toxic, meanwhile, is the only way Porygon2 can do any meaningful damage to the extremely common Rotom-W. Toxic is also Porygon2's best tool against its other main problem: other defensive Pokemon with Toxic! Discharge is a good midway option if you want to have a secondary special attack while still being able to spread paralysis, thanks to its 30% infliction rate. Discharge will allow Porygon2 to deal a good amount of damage to Azumarill, making it far more risky for Azumarill to set up Belly Drum. Discharge also allows Porygon2 to 2HKO Gyarados and offensive Talonflame. If you just want to do a bit more damage to foes (especially Azumarill) but don't care about the paralysis, you can opt to use Thunderbolt instead.
Set Details
Eviolite is what makes Porygon2 such a bulky Pokemon, so make sure you don't forget to put that on your Porygon2! The HP EVs may seem a bit strange, but they give Porygon2 an odd amount of HP. This lets Porygon2 take less damage from sand, Stealth Rock, hail, and status, giving it an extra bit of longevity at almost no cost to bulk. Maximizing the Defense stat is a must, as it allows Porygon2 to check a ton of Pokemon. The remaining EVs are put into Special Defense for an extra bit of bulk.
Usage Tips
Because Porygon2 is all about checking many of Battle Spot Singles's big threats, you'll usually find yourself using Porygon2 in a rather reactive way, switching into big threats and using the predicted switch to try to punish your opponent with status moves or Foul Play. A word of warning: in most cases, you should resist the urge to use Foul Play on Aegislash. Most Aegislash use a mixed attacking set with Weakness Policy. Porygon2 can normally wall this set, but if you use Foul Play, Aegislash will now be able to 2HKO Porygon2 with Sacred Sword!
Trace is a very unique and useful asset for Porygon2, so make sure to take advantage of it whenever possible. Defensively, Trace makes Porygon2 a great switch-in to Salamence before it Mega Evolves, as Porygon2 can lower its Attack with Intimidate. Porygon2 can also do the same with Mawile, but note that Mega Mawile beats Porygon2 one-on-one. Heatran and Manectric before it Mega Evolves are also good targets for defensive uses of Trace, due to their abilities making Porygon2 immune to their main attacks. For more offensive uses of Trace, Mega Kangaskhan is a prime target, as Parental Bond can give Porygon2 more offensive presence than usual. Greninja's Protean can also aid Porygon2 offensively and remove its Fighting-type weakness when Porygon2 uses Toxic or an Electric-type attack, but note that becoming Ice-type gives Porygon2 many new weaknesses.
If you face an opponent who doesn't appear to have a Porygon2 check, don't take that as an easy win: it's very possible that your opponent is trying to ensnare your Porygon2 with some kind of lure! For example, an opponent might be running Substitute + Toxic Aegislash or Power-Up Punch Mega Kangaskhan. When seeing these kinds of teams, consider choosing the Pokemon that are good at dealing with lure-related emergencies for your team.
On a final note, one topic that must be addressed is Mega Gengar. Mega Gengar can be specialized to become a devastatingly effective way to trap Porygon2 thanks to Destiny Bond and Taunt. Teams that use sweepers particularly weak to Porygon2 are known to do this. Mega Gengar is extremely difficult to directly check due to Shadow Tag, so the best way to check it is not so much bringing a specific Pokemon but more about planning ahead. If you see a team that could be using this kind of Mega Gengar, consider not leading with Porygon2 and possibly even making risky double switches into predicted Gengar switches. Sometimes, it's possible that the key to overcoming a matchup like this is to put Gengar into an unfavorable matchup before it Mega Evolves.
Team Options
When talking about Porygon2's teammates, it's important to first note the Pokemon that try to take advantage of Porygon2. Two of the most dangerous examples are Mega Gengar and Mega Mawile, while more general offensive threats to Porygon2 are Fighting-types such as Blaziken, Heracross, and Mega Lopunny. Moreover, Porygon2 doesn't do that great against more defensive threats. While it can cripple opposing Porygon2 and Cresselia with Toxic, having your own Porygon2 hit with Toxic can cripple its ability to check some of the more powerful threats of Battle Spot Singles. Of particular note are Ferrothorn and Mega Venusaur, which have nothing to fear from Porygon2 and can ensnare Porygon2 into the clutches of their Leech Seed! Teammates that resist Fighting are highly recommended when using Porygon2. Talonflame is a fantastic offensive example, as it can support Porygon2 in other ways. Its powerful priority Brave Bird preys on Fighting-types and smashes Mega Gengar and Mega Venusaur, while Flare Blitz scorches Mega Mawile and Ferrothorn. In a funny twist of fate, Porygon2's archnemesis, Mega Gengar, works here as well, aiding Porygon2 with a Fighting immunity and Shadow Tag to defeat many defensive Pokemon, while Porygon2's Thunder Wave allows Mega Gengar to effectively revenge kill Choice Scarf threats. On the more defensive side of teammates, Cresselia, the other premier defensive Pokemon, happens to pair reasonably well with Porygon2. Cresselia resists Fighting, while Porygon2 provides Cresselia with backup against Greninja and Aegislash (watch out for Substitute, though).
If you choose Thunder Wave in the last moveslot, make sure to take advantage of it! Most sweepers in general can find a situation where they can win a game because of paralysis, but two Pokemon in particular deserve a special mention. Mega Mawile is a fantastic teammate in this regard. Paralyzing threats such as Blaziken can give Mega Mawile the breakthrough it needs to win the game! Garchomp, while already fast on its own, is much harder to defeat when fast checks such as Mega Lopunny are crippled. Garchomp itself can aid Porygon2 in a particular emergency, surviving a +2 Sucker Punch from Mega Kangaskhan and often destroying it thanks to Rough Skin.
Take special care in avoiding Trick and Knock Off, as losing Eviolite compromises Porygon2's ability to check threats. Common users of Knock Off that don't already hit Porygon2 super effectively include Azumarill, Mega Mawile, Bisharp, and Weavile, while common users of Trick include Rotom-W and Rotom-H. Thankfully, Mega Evolutions are immune to losing their item, making them fine ways to halt attempts at removing Porygon2's Eviolite. Mega Evolutions that resist Knock Off such as Blaziken, Tyranitar, and Heracross work especially well.