An electrochemical method of preventing corrosion in a metal component, is to attach another more reactive metal with, for example, a conducting wire. The more susceptible metal, referred to as an anode, will corrode in preference to the component. This is done on boats and in water heaters.

Another method involves current being applied to the component to be protected. If you recall, corrosion requires a flow of electrons from the anode to the cathode. If an external current is applied in the other direction, then the component will be protected.