• Everything the fellow reponder (PP) said :

    Break doen into smaller queries

    Write short expressions(maybe even shorter variable names)

    Parametreized stored proc

    Might i also suggest :

    Have a .sql file in which you write out your command and then have your ssis execute that instead.

    A long winded way but will work.