It's calling Get-ParsedSql twice which should be unnecessary - you should be able to just cache the parse result and re-use that for the second one. https://github.com/dfinke/PowerShellNotebook/blob/master/ConvertToSQLNoteBook.ps1#L32 https://github.com/dfinke/PowerShellNotebook/blob/master/ConvertToSQLNoteBook.ps1#L50
It's calling Get-ParsedSql twice which should be unnecessary - you should be able to just cache the parse result and re-use that for the second one.
https://github.com/dfinke/PowerShellNotebook/blob/master/ConvertToSQLNoteBook.ps1#L32
https://github.com/dfinke/PowerShellNotebook/blob/master/ConvertToSQLNoteBook.ps1#L50