How to serialize on SQL server metadata?
In this case, if you cant serialize this in the application code you can use try/catch or an applock

begin tran
if APPLOCK_TEST ('public','idx_create','exclusive') = 1
 begin 
  EXEC sp_getapplock @Resource = 'idx_create', 
                     @lockmode = 'Exclusive', 
                     @DbPrincipal='public'
   print 'I can do it'

  -- EXEC sp_releaseapplock @Resource='idx_create', @DbPrincipal='public'
  -- scope is transaction see comment below
   commit 
 end
else rollback ;