# Miscellaneous > Ask an Expert >  if exists DROP PROCEDURE/VIEW

## anselme

how can I  drop a propcedure or a view without error for MS SQL 2000/2500

for a table

*IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[myTABLE]') AND type in (N'U'))
DROP TABLE [dbo].[myTABLE]
*

and for a procedure 

*IF  EXISTS ???
DROP PROCEDURE [dbo].[SP_myTABLE_Count]*

thank you for helping

----------


## skhanal

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_myTABLE_Count]') AND type in (N'P'))
DROP PROCEDURE [dbo].[SP_myTABLE_Count]

----------


## anselme

thank you skhanal

for a view is it ?

 AND type in (N'V'))

----------


## rmiao

Yes, you got it.

----------


## anselme

thanks rmia

----------

