You are mixing two technologies. If you want to include code in a change node, Node Red supports JSONata. However using {{ states(...) }} is Home Assistant’s templating format, which is unrelated. The only time you can use HA templates in NR is within the “render template” node, which you could use, but is unnecessary.
While you could do it in a function node using global state, it’s not very visual.
The visual programming way to do this would be to have a “current state” node before the change node which loads the sensor state into the message somewhere - by default it would load into “msg.payload”. Let’s say you instead store the state in “msg.watermeter”, then you would use that in the change node as follows (after changing from “{}” to “J”):