object definitions like procedures, views and functions can become invalid if the underlying objects they use have been altered or dropped after being created.
I created this script a while ago that i use for checking for invalid objects.
this script finds all Invalid Objects in SQL that no longer compile due to dropped/renamed objects or columns, for example.
there's no way to discover this info without actually trying to recompile, AFAIK.
for Invalid Objects, it's not like oracle, where there is a column to query to test whether something was compiled successfully.
note this doesn't give you a list of what is broken NOW, but rather tries to recompile everything, and reports what fails to compile.
if you have an object that does not follow this convention(single space between create and object type),
you might get an error "There is already an object named 'SP_XXXX' in the database." as an error, which is because the REPLACE did not successfully replace the CREATE with an ALTER
so the script tries to CREATE instead of alter.
convention: CREATE[single space]PROC...CREATE[single space]VIEW...CREATE[single space]FUNCTIONsp_InvalidObjects.txt
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!