SET NOCOUNT ON

IF NOT EXISTS
(
  SELECT SysColumns.Name 
  FROM SysObjects WITH (NOLOCK) 
    INNER JOIN SysColumns WITH (NOLOCK) ON SysColumns.Id = SysObjects.ID 
    AND SysColumns.Name = 'AttachedRoomLine'
    WHERE SysObjects.Name = 'ArrangementLines'
)
  ALTER TABLE ArrangementLines ADD AttachedRoomLine VARCHAR(50) NULL 
GO

IF NOT EXISTS (SELECT name FROM SysIndexes WITH (NOLOCK) WHERE name = 'IX_ArrangementLines_AttachedRoomLine')
	CREATE NONCLUSTERED INDEX [IX_ArrangementLines_AttachedRoomLine] ON [dbo].[ArrangementLines] 
	(
		[AttachedRoomLine] DESC
	)
GO