Common salt comprises a very stable, simple chemical compound called sodium chloride, which has a salty flavour. As table salt, it typically also contains minor amounts of additives to keep it free-flowing.
As it is so chemically stable, sodium chloride will not lose its saltiness, even after being stored dry for many years. However, there are ways in which salt may appear to lose its saltiness.
Historically, salt has been obtained from crude sources such as salt marshes, and minerals such as rock salt. This contains the stable sodium chloride plus other components. Sodium chloride is readily water-soluble, so if this crude salt were exposed to condensation or rain water, the sodium chloride could be dissolved and removed, and the salt could in effect lose its saltiness.
Also, the salty flavour is detected by our sense of taste. If there were a physiological change in the functioning of our taste buds, salt consumed may no longer taste the same, but this would not be due to any inherent change in the salt itself.
In summary, salt, i.e. sodium chloride, is a very stable material which retains its properties when stored dry.