Have a look in MSysQueries.
You can get the ObjectId from MSysObjects.