title: How to check if a function exists in a SQL database?
body: <p>I need to find out if a function exists in a database, so that I can drop it and create it again. It should basically be something like the following code that I use for stored procedures:</p>
  <pre><code>IF EXISTS (
       SELECT  *
       FROM    dbo.sysobjects
       WHERE   id = OBJECT_ID(N'[dbo].[SP_TEST]')
               AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
  </code></pre>