• Fixed this by adding the code below. Yet this is a bug in SQL 2014.

    $path = "A:MyDB\08_SPs $timestamp.sql"

    $word = "ALTER "

    $replacement = "GO `r`n ALTER "

    $text = get-content $path

    $newText = $text -replace $word,$replacement

    $newText > $path