“Identity” is episode eighteen of season five of Stargate: Atlantis.
Someone unfamiliar is wandering Atlantis. After stabbing Zelenka, she sees herself in a mirror and the face that looks back is that of Dr. Jennifer Keller.
Dr. Keller is being possessed by an alien entity, but everyone else thinks that she is Dr. Keller and so is somewhat confused. The entity seems confused herself, and doesn’t seem to know where she is. Carson Beckett returns to Atlantis to help out whilst she is ‘ill.’ Nothing physically can be found wrong with Jennifer, so Beckett believes there may be a psychological problem.
When she tries to kill Rodney too, Ronon stuns her, and they realise that she stabbed Zalenka and that Jennifer isn’t Jennifer. Instead, she is someone called Neeva who doesn’t know how she got there, except that she was playing with an alien artefact when the transfer happened.
Jennifer apparently touched an ancient communication device, of a type discovered previously by SG-1. Jennifer is in Neeva’s body, and that has been captured. Neeva is not a nice person, and so Jennifer has been sentenced to death, giving the team a deadline to find her, before her consciousness is killed in Neeva’s body.