As m777182 has said it would be possible to measure density with a nucleonic type device. This would work with the following principle that materials of greater density absorb more gamma radiation. Thus if you can guarantee the process flowing is constant, any other absorbed radiation must be due to a higher density material flowing past the nucleonic. Meaning in a spot measurement you could determine how much solid / sand is passing that point and equate that to volume of sand per barrel.
The problem is that the process is very often not a stable flow thus errors can occur.
What is the route of the pipeline downstream is it into a vessel / separator? There are many devices that would be able to monitor sand / solid build up in a vessel for instance a phase profiler.