You will pretty much have to contact law enforcement and let them "run" the weapon. It will be checked against the "stolen gun" file in the national database, similar to the "stolen vehicle" and "wanted person" files. Guns that are stolen stay in this file forever.
However, a large number of stolen weapons are not entered, for one simple reason; the owner does not know the serial number (sad but true). The only way those weapons will be recovered is if the agency encountering them reports them to ATF and has them "traced," a process which entails starting at the weapon's manufacturer and following it though every licensed transfer. If the weapon went through private transfer(s) before it was stolen, tough luck, because there will be no records of it. This process takes a couple of months.
If the weapon is stolen, why would you want to keep it, anyway? It needs to go back to its lawful owner. Don't mess around with a weapon you think is stolen. If you do have a weapon that turns out to be stolen, and you lack a reasonable explanation where it came from (like, I bought it from this guy, here is his name, date of birth, address and driver's license information) you will most likely get charged with possessing a stolen gun, which is a felony in most places.