When we have a part that tends to corrode; Is it possible to apply an electrode on it to sense the excess or deficit of electrons on it that make it prone to corrosion and accordingly send a current that will drive that excess or deficit of electrons away? So that it will protect the part from corrosion?
I believe what you are suggesting is impressed current corrosion protection. It is used commonly in pipeline and underground storage tank applications. Example
ICCP is superior to sacrificial anode protection but is an active process while the latter is passive.
If you do not coat the substrate I would think it would be corroding at a fairly steady state; so you would need to supply the current continuously. The case of when the automobile is not running would need to be addressed.
If you do coat the substrate then you would be adding a redundancy which drives up cost and you still have to account for a power source during automobile downtime.
Either way it is important to note that they both require an anode. If the anode in ICCP is less noble than steel then it will deteriorate. If it is more noble then you would need constant current or galvanic attack on the substrate would occur.
There are two options: a passive method and an active method.
The Passive method is to use a sacrificial zinc anode. The zinc corrodes instead of the metal that it is attached to. More information about the mechanics of the system can be found on the Wikipedia page.
The Active method sounds more like what you are asking for in your question. This method imposes a DC current on the structure to effectively drive the chemical reaction away from reaction with the metal that it is protecting. As above, more information can be found on Wikipedia.
Both of these methods provide constant protection and aren't turned on and off.
What you're describing sounds like a galvanic cathode protection system. In this system, a sacrificial anode is connected to the metal part to be protected. The material in the anode is chosen such that it has a lower electropotential than the protected part so that it preferentially corrodes instead of the part. The electrical connection between the part and the anode allows current to flow, which forces the part to become more cathode-like, which slows its rate of oxidation.