This is a complicated answer, because it depends on how much sand went in, what was in the sand, the sand’s composition and grain size, the position of the valves and the design of the engine. Best-case scenario, a few grains of sand will just blow out of the exhaust valve when you start the engine. It’s safe to say, though, that a certain amount will stick to the oil on your piston, or will stick as soon as fuel enters the chamber. Sand comes in many varieties, but most contains a fair amount of silicon dioxide in the form of crushed up quartz. Quartz is incredibly hard, and you can bet that it will scuff your cylinder walls and lead to a loss in compression later. It can also damage the valves, but odds are good that the valves will hammer it into finer dust before immediate damage occurs. Still, it can easily cause valve seat problems later, Check the engine by car obd2 tool, it is easy and quickly.
Sand can even cause a problem if it sticks to the plug threads and gets crushed into dust when you tighten the plug. Consider this: A lighting bolt of 1.21 gigawatts can travel many miles through the open air — a terrible electrical conductor — but will stop dead within a few inches or feet after hitting the ground. Quartz is as impressive an electrical insulator as it is an abrasive, and even a thin layer of quartz dust on the plug threads can interfere with the plug’s ground and drop spark voltage.
If you’ve got sand in the engine, there isn’t much you can do aside from tearing the engine apart to clean it, the best you can hope for it that the engine pulverizes the larger sand grains before they cause immediate damage. But one way or the other, that sand probably took at least a few years off you engine’s lifespan, use the car diagnostic tool to protect the car.