“Doppelganger” is episode four of season four of Stargate: Atlantis.
Whilst exploring a new planet, McKay discovers a crystalline growth that gives off strange energy readings.
Sheppard touches it, for no reason he can explain, and gets a shock that knocks him backwards.
Following their return to Atlantis, people start suffering from nightmares, starting with Teyla, but soon others start complaining of them too. All the nightmares involve Colonel Sheppard in some way, and not a good way.
The nightmares seem to be oddly contagious and to be spread by contact, with the previous person no longer being affected.
One of the creepier episodes, but still not as creepy as it could have been. A bit of a lost opportunity, but they did annoyingly kill off a minor character.