Reference the database from a stored proc?
If db_id() is called with no parameter it returns the id of the current database  - http://msdn.microsoft.com/en-us/library/ms186274.aspx

so you could just use:
set @db_id=db_id()

And having read the rest of the question, you could call object_id() without the db name. If the object exists you'll get the id, if not NULL. So:
SET @object_id = OBJECT_ID(N'dbo.Users');