For in-game, Pikachu is not viable even if Gmax because there are better Electric-types in the game like Toxtricity and Manetric. Pikachu lacks good stats late-game, so you could use it early game. You might find some use in Raihan's, double battle since it paralyses both Pokemon, but it's not worth it. Maybe up to Nessa it's usable, but after that the Pokemon get too strong for Pikachu.
But since you want Pikachu to be viable, here's a set:
Pikachu @ Light Ball
Thunderbolt
Surf
Grass knot
Nasty plot
Competitive: Honestly I searched a long time and found nothing related to Pikachu being viable in any tier. I assume this means Pikachu just isn't viable, so I just had think for myself and Gmax Pikachu might find use in the lower tiers of doubles, but it's not viable by any means. I can't do anything about that, but its Gmax move paralyses both Pokemon; pair up Surf with something like Water Absorb or Storm Drain and it's pretty decent. Also there's the Air Balloon Shedinja strategy that I'm not talking about, it's too situational anyway. Here's the competitive set for Pikachu:
Pikachu @Light Ball/Air Balloon
EVs: 4 HP / 252 SpA / 252 Spe
Nature: Modest/Timid (preferably Timid)
Discharge/Thunderbolt
Surf
Protect
Volt switch