That was clear. But in that case you can not find a table usage in the following conditions:
1) If the table name is not flanked by square brackets
2) If the table name is not prefixed with owner
Ex: If inside the SP you have code like this
SELECT COL1,COL2 FROM TABLE1
Then the script will fail to recognize the table usage of TABLE1
Moreover even by square bracketing we can not avoid wrong search when say a table name and a column name matches exactly and the column name has also been square bracketed in the SP.
Another case is when a statement is commented inside the SP /view/function. Then also the script will return the SP name if the commented statement contains the searched table.
Basically we can be 100% sure of the usage, only when we write some parser kind of program to parse it well.
Anyway, this script will be very handy for many user if we know the above facts and judiciously use it.
The additional clauses between the brackets are trying to ignore partial matches. e.g. if you were searching for customer then it wouldn't return customerid. In most cases you probably want to return partial matches too though since it can't hurt.
The script is good but unfortunately didn't work for me for finding the existence of a table in Views. I don't know why you are using LIKE '%[ ,=]' + t.TableName + '[ .,]%' when the simple LIKE '%' + t.TableName + '%' will give you the desired result.
I modified this SP as I said above and it is giving me the correct result.