Resourceful do-it-yourselfer can add a comment with type, make and model number of product for best answer.
1) Open following link if you have electric tank-type water heater, for tested, full service do-it-yourself diagnosis.http://waterheatertimer.org/How-to-troubleshoot-electric-problems-with-water-heater.html
Open top cover and push in ECO reset button:http://waterheatertimer.org/images/Jly-022-thermostat2-175.jpg
Find age of water heater using serial number located on label on side of tank:http://waterheatertimer.org/pdf/WaterHeaterSerialNumberDecoder.pdf
2) If you have tank-type gas water heater, thermostat is connected to gas valve, but you might have question about gas flame instead of thermostat.
Check manual, check flame, buy new gas valve at local home center.
Following link shows typical gas valve with brass thermostat:http://waterheatertimer.org/images/316938_603.jpg
3) If you have tankless electric or gas, the problem can be varied from internal to external causes.
Check manual, call service technician.
Add a comment for more free help.
Also take advantage of fixya expert assistance live.
For a price, expert works with you while you work on water heater or any do-it-yourself project.
Fixya is always less expensive than a service call.