Pamela Mooney has a script to validate that transactional replication is up to date:
You may sometimes have reports or other processes that are dependent on transactional replication being current. If that is the case, you will probably need a mechanism to check and see if, in fact, replication is caught up. Here is my solution to that, without having to resort to Replication Monitor all the time. The bonus? This could be inserted into conditional workflows to help streamline processes (i.e., validate publications before moving on to Step 2 of process).
To do this, I chose to make three stored procedures. The first one to just check all publications on a server, one to check just one publication on a server, and one central sproc to rule them all. You simply execute the master stored procedure, and based on the parameters you feed, it decides which of the other two to execute.
Read on for those scripts.