It happens constantly all day long.
Most mining software handles this by adjusting the timestamp in the blockheader.
If your mining hardware is fast enough (and/or your pool is big enough), you can run into the situation where you haven't received any new transactions that you want to include AND you are unable to adjust the timestamp any further (the protocol has limitations on how much the next timestamp is allowed to vary).
In this case, you now have to modify your merkle root. You can keep track of the merkle root building hash that occured prior to the one that is in the blockheader, and then all you have to do is change the arbitrary data in the input of the coinbase transaction (generally called extranonce), finish off the merkle root and return to the loop above with timestamp adjustments again as well.