For example: if I used Memento then the opponent shifts out the victim is he still affected of did my Pokemon lose its life for nothing?
Yes, the stat changes are removed.
Memento isn't an entirely useless move though; when your Pokemon faints, you get a free opportunity to switch in and set up on your opponent who can't touch you due to their lowered offences. Even if they switch out, you will have gained a boost possibly from a move like Swords Dance that will allow you to deal a good amount of damage to the opponent.