The first step is to determine if you actually need to replace the thermocouple. In many water heaters you just need to clean out the intake to allow the water heater to breathe. In other cases a bad gas valve can be at fault and is often blamed on the thermocouple.
Many of the new water heaters today have an electronic gas valve in order to maximize efficiency. These high efficiency gas valves often have complicated parts that may be specific to the brand of water heater. State Industries, GE, Whirlpool, and Kenmore all have an electronic thermocouple. This means you will need to order the specific part for your model instead of being able to pick one up at the box store.
Usually a bad thermocouple will be indicated by a pilot light that has gone out. After relighting the pilot it may stay lit for about 20 seconds and will be followed by a click. This is the best indication that the thermocouple needs to be replaced.