Unless your sterling silver necklace is of very high quality you should take the sterling silver necklace off before showering to prevent the sterling silver from tarnishing which can ruin the sterling silver necklace.
There's really no reason to shower with the necklace on so it's best to avoid damaging the jewelry and just remove it before showering or bathing.
When your jewelry tarnishes it can also discolor your skin so it's not just the necklace that gets harmed it can transfer over to your skin which can be hard to get rid of.