I needed a script to script out all the indexes with their included columns. All the scripts I could find on the inernet only scripted the normal columns, so I created my own script to script all columns and included columns.
At the moment this script does not support Fill Factor, Filters, With Options or File Groups.
If and when I make any changes I will update this script. If you like you can make changes and send them to me and I’ll update accordingly
ALTER PROC ScriptOutIndexes AS SET NOCOUNT ON SELECT OBJECT_NAME([ixs].[object_id]) 'table_name' ,[ixs].[type] 'index_type' ,[ixs].[type_desc] ,[ixs].[name] 'index_name' ,[ixs].[is_unique] ,[ixs].[fill_factor] ,[ix_col].[key_ordinal] ,[col].[name] 'column_name' ,[ix_col].[is_descending_key] ,[is_included_column]