Yes, also it doesnt technically have to be sand, there are concrete mixes and even just bedrock that can be used for similar purposes. I've been looking at sand batteries myself for this reason: run the battery hot when power is cheap, let it cool when not.
This sort of thing is of course why it's useful to have a market mechanism for energy, it can encourage us to build environmentally friendly solutions.