See Rigid Designators :
Kripke famously argues that because a rigid designator designates the same object in all possible worlds, an identity statement in which both designators are rigid must be necessarily true if it is true at all.
‘Hesperus = Phosphorus’ is necessarily true if true at all because ‘Hesperus’ and ‘Phosphorus’ are proper names for the same object. Like other names, Kripke maintains, they are rigid: each designates just the object it actually designates in all possible worlds in which that object exists, and it designates nothing else in any possible world. The object that ‘Hesperus’ and ‘Phosphorus’ name in all possible worlds is Venus.