title: Validate T-SQL programmability objects
body: <p>Is there a way to validate programmability objects in SQL Server 2008?</p>
  
  <p>I have a database with ~500 programmability objects which depend on other programmability objects (not only tables).</p>
  
  <p>If I do some refactoring, it is very hard find other objects which are broken by the changes. For example if I change the parameter count...</p>
  
  <p>Original state of database:</p>
  
  <pre><code>CREATE FUNCTION [dbo].[GetSomeText]() RETURNS nvarchar(max) AS BEGIN RETURN 'asdf' END
  
  /* uses "GetSomeText()" function */
  CREATE FUNCTION [dbo].[GetOtherText]() RETURNS nvarchar(max) AS BEGIN RETURN [dbo].[GetSomeText]() + '-qwer' END
  </code></pre>
  
  <p>Now I do some refactoring (add parameter <code>@Num</code> to <code>GetSomeText()</code> function):</p>
  
  <pre><code>ALTER FUNCTION [dbo].[GetSomeText](@Num int) RETURNS nvarchar(max) AS BEGIN RETURN 'asdf' + CAST(@Num as nvarchar(max)) END
  </code></pre>
  
  <p>Now the function <code>GetOtherText()</code> is broken, because it is calling <code>GetSomeText()</code> function without a required parameter.</p>
  
  <p>Is there a way to get information about this error?</p>
  
  <p>Currently I script every programmability object as <code>ALTER</code>, run the alter script, and check for errors. This way looks to be too complex (and is hard to use in T-SQL only enviroment).</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Thanks for answers! I know how to get dependenices or list of all objects.
  The problem is in checking the body of object. If I get the dependency, is there other way to check validity than run <code>ALTER</code> script?</p>