Short of opening up the end-cap, there isn't a good way to tell which it is. You could try banging/hitting a pipe elsewhere in the house, to see if you can hear the banging. Also, look at other exposed piping to see what materials were used for the various utilities.
Pipe like that could be water, but it also could be oil or natural gas.
There is a chance that it is a drain, but I find it unlikely.
Before opening the pipe, turn off the utilities for the building. Loosen the cap by using two pipe wrenches, one for the cap, and another for the pipe. As the connection is opened, some water will leak out, or gas (and you'd smell its characteristic odour). Retightening the cap may not completely seal it. It may need to be removed, cleaned, be applied with pipe dope, and reinstalled.
The pipe could be made of any of a few different materials, such as galvanized steel, "black iron", copper, or brass.
Black iron pipe is often used for natural gas while galvanized steel and brass are used for water (though sometimes the wrong type is used, so this is not a reliable way to tell its contents). Copper is used for both water and gas.