Is it OK to create a third prong ground from a cold water pipe, for a 2-wire circuit?
When or is it NEC code compliant to upgrade a 2-wire circuit, by adding a third prong equipment ground from a nearby galvanized cold water pipe?


Never!

Article 250.118 of the National Electrical Code lists the approved methods of equipment grounding. Water piping systems are NOT listed there.

Metal piping systems within buildings are required to be bonded to the electrical grounding system to prevent them from becoming energized. They are not used AS an equipment grounding conductor for circuits.

Spend the time, effort, and money to run a separate equipment ground back to the service panel or to another circuit with a ground as you cited in the other example.

Good luck!