A water heater gas valve is just one of several components that can fail on a water heater. Before you replace the valve, you should do some basic troubleshooting to ensure that really is where the problem is. Here is some basic information to help you pin down the cause of the problem you are experiencing.
Preparing to Troubleshoot
Before you start any kind of troubleshooting you should make sure the power to the heater is turned off. Turn the gas valve to the 'pilot' setting, and shut off the water to the heater. This will make it safe to troubleshoot.
No Hot Water
If your unit isn't producing any hot water, it could be a number of things. A faulty gas pilot, gas valve, or thermostat are the three most common problems in this situation. To check this, you will first want to check the pilot flame. If it's operating correctly, then this isn't the cause. The pilot is the most common reason for a lack of hot water. It could be the gas pilot valve. The gas pilot valve is the piece that supplies fire to the gas. If the valve is working, hot water shouldn't be an issue. If the valve is the cause, then a professional will likely need to repair this. If the pilot isn't the issue, then replacing the gas valve should correct the problem.
Gas Pilot Issues
It's not uncommon for a gas pilot to not stay lit after a repair has been made. A draft coming off the main vent can blow it out. Even the simple act of opening and closing the closet door where the heater is located is enough to cause the pilot to blow out. If you've already checked this, and the pilot still won't stay lit, you can check to ensure you have the vent cap in place properly. If this is in place, and you have checked the thermocoupling, calling in a professional is the best way to go.
A leaky gas valve is not only a pain, it can be dangerous. You can easily test for leaks around the valve using soapy water and a spray bottle. Spray the fittings near the valve with a soapy water solution. If you see bubbles, you have a leak. Once you locate the leak you can either replace the fittings, or install a new valve to solve the problem. Before you begin any repair, you will need to contact your gas company and notify them of a possible leak. The gas will be cut off to the home, and a technician will be dispatched. This is necessary to keep the situation from becoming very dangerous. Once the repair has been made, the technician will determine if it's safe to turn the gas supply back on.
Anytime a gas appliance gives you trouble, it's best to diagnose and correct the situation immediately. Faulty gas appliances can cause fires and explosions. If you aren't comfortable working with gas, a professional should be contacted to correct the situation for you.