• I know this is an old post, but I would advise to be very careful with this script.

    In bol under indexproperty:

    IsPageLockDisallowed

    Page-locking value set by the ALLOW_PAGE_LOCKS option of ALTER INDEX.

    1 = Page locking is disallowed.

    0 = Page locking is allowed.

    Script states

    IF (INDEXPROPERTY(@idxTableID, @idxname, 'IsPageLockDisallowed') = 1)

    SET @sParamSQL = @sParamSQL + ' ALLOW_PAGE_LOCKS = ON, '

    ELSE

    SET @sParamSQL = @sParamSQL + ' ALLOW_PAGE_LOCKS = OFF, '

    This is the oposite and can cause serious performance loss (extra locking).