• WHERE

    ius.database_id = DB_ID()

    AND DB_NAME(ius.database_id)=@YourDatabaseName

    The first condition is sufficient right? ius.database_id = DB_ID() should uniquely identify the correct database without the need for checking the db name as well.

    Or am I missing something?

    Thanks!