or it shud be like below
create procedure aa
as
begin
if exists (select * from sys.objects where name='bb')
begin
drop procedure bb
declare @a nvarchar(max)
set @a='create procedure bb as begin print ''bb'' end'
exec sp_executesql @a
end
end
But as Gail's suggestion.... why u want to do this??? is this some class room based question???