create procedure [sys].[sp_MSdrop_cdc]
as
if object_id('[sys].[sp_MSverboselogging]', 'P') is not null
drop procedure [sys].[sp_MSverboselogging]
if object_id('[sys].[sp_cdc_scan]', 'P') is not null
drop procedure [sys].[sp_cdc_scan]
if object_id('[sys].[sp_cdc_get_job_parameters]', 'P') is not null
drop procedure [sys].[sp_cdc_get_job_parameters]
if object_id('[sys].[sp_MScdc_capture_job]', 'P') is not null
drop procedure [sys].[sp_MScdc_capture_job]
if object_id('[sys].[sp_MScdc_ddl_server_trigger]', 'P') is not null
drop procedure [sys].[sp_MScdc_ddl_server_trigger]
if object_id('[sys].[sp_MScdc_ddl_database_triggers]', 'P') is not null
drop procedure [sys].[sp_MScdc_ddl_database_triggers]
if object_id('[sys].[sp_MScdc_ddl_event]', 'P') is not null
drop procedure [sys].[sp_MScdc_ddl_event]
if object_id('[sys].[sp_cdc_ddl_event_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_ddl_event_internal]
if object_id('[sys].[sp_MScdc_db_ddl_event]', 'P') is not null
drop procedure [sys].[sp_MScdc_db_ddl_event]
if object_id('[sys].[sp_cdc_cleanup_job_entries]', 'P') is not null
drop procedure [sys].[sp_cdc_cleanup_job_entries]
if object_id('[sys].[sp_MScdc_logddl]', 'P') is not null
drop procedure [sys].[sp_MScdc_logddl]
if object_id('[sys].[sp_cdc_logddl_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_logddl_internal]
if object_id('[sys].[fn_cdc_is_db_enabled]', 'FN') is not null
drop function [sys].[fn_cdc_is_db_enabled]
if object_id('[sys].[fn_cdc_is_table_enabled]', 'FN') is not null
drop function [sys].[fn_cdc_is_table_enabled]
if object_id('[sys].[fn_cdc_dropped_tables]', 'FN') is not null
drop function [sys].[fn_cdc_dropped_tables]
if object_id('[sys].[fn_cdc_index_required]', 'FN') is not null
drop function [sys].[fn_cdc_index_required]
if object_id('[sys].[fn_cdc_constraint_required]', 'FN') is not null
drop function [sys].[fn_cdc_constraint_required]
if object_id('[sys].[fn_cdc_get_source]', 'FN') is not null
drop function [sys].[fn_cdc_get_source]
if object_id('[sys].[fn_cdc_get_role]', 'FN') is not null
drop function [sys].[fn_cdc_get_role]
if object_id('[sys].[fn_cdc_get_jobid]', 'TF') is not null
drop function [sys].[fn_cdc_get_jobid]
if object_id('[sys].[fn_cdc_jobs]', 'FN') is not null
drop function [sys].[fn_cdc_jobs]
if object_id('[sys].[fn_cdc_job_entry]', 'FN') is not null
drop function [sys].[fn_cdc_job_entry]
if object_id('[sys].[fn_cdc_db_name_from_job_entry]', 'FN') is not null
drop function [sys].[fn_cdc_db_name_from_job_entry]
if object_id('[sys].[fn_cdc_get_start_lsn]', 'FN') is not null
drop function [sys].[fn_cdc_get_start_lsn]
if object_id('[sys].[fn_cdc_hexstrtobin]', 'FN') is not null
drop function [sys].[fn_cdc_hexstrtobin]
if object_id('[sys].[sp_cdc_dbsnapshotLSN]', 'P') is not null
drop procedure [sys].[sp_cdc_dbsnapshotLSN]
if object_id('[sys].[fn_cdc_trim_whitespace]', 'FN') is not null
drop function [sys].[fn_cdc_trim_whitespace]
if object_id('[sys].[fn_cdc_get_column_list]', 'TF') is not null
drop function [sys].[fn_cdc_get_column_list]
if object_id('[sys].[fn_cdc_db_objects_exist]', 'FN') is not null
drop function [sys].[fn_cdc_db_objects_exist]
if object_id('[sys].[fn_cdc_compute_low_water_mark]', 'FN') is not null
drop function [sys].[fn_cdc_compute_low_water_mark]
if object_id('[sys].[fn_cdc_format_type]', 'FN') is not null
drop function [sys].[fn_cdc_format_type]
if object_id('[sys].[fn_cdc_next_right_quote]', 'FN') is not null
drop function [sys].[fn_cdc_next_right_quote]
if object_id('[sys].[sp_cdc_create_functions]', 'P') is not null
drop procedure [sys].[sp_cdc_create_functions]
if object_id('[sys].[sp_cdc_lsn_time_mapping_procs]', 'P') is not null
drop procedure [sys].[sp_cdc_lsn_time_mapping_procs]
if object_id('[sys].[sp_cdc_create_populate_stored_procs]', 'P') is not null
drop procedure [sys].[sp_cdc_create_populate_stored_procs]
if object_id('[sys].[sp_cdc_create_objects]', 'P') is not null
drop procedure [sys].[sp_cdc_create_objects]
if object_id('[sys].[sp_cdc_drop_change_table_objects]', 'P') is not null
drop procedure [sys].[sp_cdc_drop_change_table_objects]
if object_id('[sys].[sp_cdc_drop_objects]', 'P') is not null
drop procedure [sys].[sp_cdc_drop_objects]
if object_id('[sys].[sp_cdc_verify_capture_instance]', 'P') is not null
drop procedure [sys].[sp_cdc_verify_capture_instance]
if object_id('[sys].[sp_cdc_verify_index_name]', 'P') is not null
drop procedure [sys].[sp_cdc_verify_index_name]
if object_id('[sys].[sp_cdc_verify_role_name]', 'P') is not null
drop procedure [sys].[sp_cdc_verify_role_name]
if object_id('[sys].[sp_cdc_extract_column]', 'P') is not null
drop procedure [sys].[sp_cdc_extract_column]
if object_id('[sys].[sp_cdc_parse_captured_column_list]', 'P') is not null
drop procedure [sys].[sp_cdc_parse_captured_column_list]
if object_id('[sys].[sp_cdc_parse_included_column_list]', 'P') is not null
drop procedure [sys].[sp_cdc_parse_included_column_list]
if object_id('[sys].[sp_cdc_parse_update_flag_list]', 'P') is not null
drop procedure [sys].[sp_cdc_parse_update_flag_list]
if object_id('[sys].[sp_cdc_create_change_table]', 'P') is not null
drop procedure [sys].[sp_cdc_create_change_table]
if object_id('[sys].[sp_cdc_create_change_table_index]', 'P') is not null
drop procedure [sys].[sp_cdc_create_change_table_index]
if object_id('[sys].[sp_cdc_create_change_enumeration_functions]', 'P') is not null
drop procedure [sys].[sp_cdc_create_change_enumeration_functions]
if object_id('[sys].[sp_cdc_create_change_enumeration_wrapper_function]', 'P') is not null
drop procedure [sys].[sp_cdc_create_change_enumeration_wrapper_function]
if object_id('[sys].[sp_cdc_grant_select_on_change_enumeration_functions]', 'P') is not null
drop procedure [sys].[sp_cdc_grant_select_on_change_enumeration_functions]
if object_id('[sys].[sp_cdc_cleanup_change_tables]', 'P') is not null
drop procedure [sys].[sp_cdc_cleanup_change_tables]
if object_id('[sys].[sp_cdc_enable_db]', 'P') is not null
drop procedure [sys].[sp_cdc_enable_db]
if object_id('[sys].[sp_cdc_enable_db_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_enable_db_internal]
if object_id('[sys].[sp_cdc_disable_db]', 'P') is not null
drop procedure [sys].[sp_cdc_disable_db]
if object_id('[sys].[sp_cdc_disable_db_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_disable_db_internal]
if object_id('[sys].[sp_cdc_enable_table]', 'P') is not null
drop procedure [sys].[sp_cdc_enable_table]
if object_id('[sys].[sp_cdc_enable_table_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_enable_table_internal]
if object_id('[sys].[sp_cdc_disable_table]', 'P') is not null
drop procedure [sys].[sp_cdc_disable_table]
if object_id('[sys].[sp_cdc_disable_table_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_disable_table_internal]
if object_id('[sys].[sp_cdc_get_cleanup_retention]', 'P') is not null
drop procedure [sys].[sp_cdc_get_cleanup_retention]
if object_id('[sys].[sp_cdc_cleanup_job_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_cleanup_job_internal]
if object_id('[sys].[sp_MScdc_cleanup_job]', 'P') is not null
drop procedure [sys].[sp_MScdc_cleanup_job]
if object_id('[sys].[sp_cdc_cleanup_change_table_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_cleanup_change_table_internal]
if object_id('[sys].[sp_cdc_cleanup_change_table]', 'P') is not null
drop procedure [sys].[sp_cdc_cleanup_change_table]
if object_id('[sys].[sp_cdc_disable_table_instance]', 'P') is not null
drop procedure [sys].[sp_cdc_disable_table_instance]
if object_id('[sys].[sp_cdc_add_job_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_add_job_internal]
if object_id('[sys].[sp_cdc_add_job]', 'P') is not null
drop procedure [sys].[sp_cdc_add_job]
if object_id('[sys].[sp_cdc_drop_job_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_drop_job_internal]
if object_id('[sys].[sp_cdc_drop_job]', 'P') is not null
drop procedure [sys].[sp_cdc_drop_job]
if object_id('[sys].[sp_cdc_start_job_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_start_job_internal]
if object_id('[sys].[sp_cdc_start_job]', 'P') is not null
drop procedure [sys].[sp_cdc_start_job]
if object_id('[sys].[sp_cdc_stop_job_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_stop_job_internal]
if object_id('[sys].[sp_cdc_stop_job]', 'P') is not null
drop procedure [sys].[sp_cdc_stop_job]
if object_id('[sys].[sp_cdc_help_jobs_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_help_jobs_internal]
if object_id('[sys].[sp_cdc_help_jobs]', 'P') is not null
drop procedure [sys].[sp_cdc_help_jobs]
if object_id('[sys].[sp_cdc_change_job_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_change_job_internal]
if object_id('[sys].[sp_cdc_change_job]', 'P') is not null
drop procedure [sys].[sp_cdc_change_job]
if object_id('[sys].[sp_MScdc_job_security_check]', 'P') is not null
drop procedure [sys].[sp_MScdc_job_security_check]
if object_id('[sys].[sp_cdc_restoredb]', 'P') is not null
drop procedure [sys].[sp_cdc_restoredb]
if object_id('[sys].[sp_cdc_restoredb_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_restoredb_internal]
if object_id('[sys].[sp_MScdc_tranrepl_check]', 'P') is not null
drop procedure [sys].[sp_MScdc_tranrepl_check]
if object_id('[sys].[sp_cdc_vupgrade]', 'P') is not null
drop procedure [sys].[sp_cdc_vupgrade]
if object_id('[sys].[sp_cdc_vupgrade_databases]', 'P') is not null
drop procedure [sys].[sp_cdc_vupgrade_databases]
if object_id('[sys].[sp_cdc_get_capture_instances]', 'P') is not null
drop procedure [sys].[sp_cdc_get_capture_instances]
if object_id('[sys].[sp_cdc_help_change_data_capture]', 'P') is not null
drop procedure [sys].[sp_cdc_help_change_data_capture]
if object_id('[sys].[sp_cdc_change_data_capture]', 'P') is not null
drop procedure [sys].[sp_cdc_change_data_capture]
if object_id('[sys].[sp_cdc_get_captured_columns]', 'P') is not null
drop procedure [sys].[sp_cdc_get_captured_columns]
if object_id('[sys].[sp_cdc_captured_columns]', 'P') is not null
drop procedure [sys].[sp_cdc_captured_columns]
if object_id('[sys].[sp_cdc_get_ddl_history]', 'P') is not null
drop procedure [sys].[sp_cdc_get_ddl_history]
if object_id('[sys].[sp_cdc_ddl_history]', 'P') is not null
drop procedure [sys].[sp_cdc_ddl_history]
if object_id('[sys].[sp_cdc_generate_wrapper_function]', 'P') is not null
drop procedure [sys].[sp_cdc_generate_wrapper_function]
if object_id('[sys].[sp_cdc_generate_wrapper_function_internal]', 'P') is not null
drop procedure [sys].[sp_cdc_generate_wrapper_function_internal]
if object_id('[sys].[fn_cdc_has_select_access]', 'FN') is not null
drop function [sys].[fn_cdc_has_select_access]
if object_id('[sys].[fn_cdc_is_range_valid]', 'FN') is not null
drop function [sys].[fn_cdc_is_range_valid]
if object_id('[sys].[fn_cdc_check_parameters]', 'FN') is not null
drop function [sys].[fn_cdc_check_parameters]
if object_id('[sys].[fn_cdc_all_changes_range_error]', 'FN') is not null
drop function [sys].[fn_cdc_all_changes_range_error]
if object_id('[sys].[fn_cdc_net_changes_range_error]', 'FN') is not null
drop function [sys].[fn_cdc_net_changes_range_error]
if object_id('[sys].[fn_cdc_get_min_lsn]', 'FN') is not null
drop function [sys].[fn_cdc_get_min_lsn]
if object_id('[sys].[fn_cdc_get_max_lsn]', 'FN') is not null
drop function [sys].[fn_cdc_get_max_lsn]
if object_id('[sys].[fn_cdc_map_time_to_lsn]', 'FN') is not null
drop function [sys].[fn_cdc_map_time_to_lsn]
if object_id('[sys].[fn_cdc_map_lsn_to_time]', 'FN') is not null
drop function [sys].[fn_cdc_map_lsn_to_time]
if object_id('[sys].[fn_cdc_has_column_changed]', 'FN') is not null
drop function [sys].[fn_cdc_has_column_changed]
if object_id('[sys].[fn_cdc_get_column_ordinal_internal]', 'FN') is not null
drop function [sys].[fn_cdc_get_column_ordinal_internal]
if object_id('[sys].[fn_cdc_get_column_ordinal]', 'FN') is not null
drop function [sys].[fn_cdc_get_column_ordinal]
IF object_id('sys.dm_cdc_log_scan_sessions', 'V') IS NOT NULL
drop view sys.dm_cdc_log_scan_sessions
IF object_id('sys.dm_cdc_errors', 'V') IS NOT NULL
drop view sys.dm_cdc_errors
if object_id('[sys].[sp_MScdccheck_ddladmin]', 'P') is not null
drop procedure [sys].[sp_MScdccheck_ddladmin]