Hello there,
I think I found your problem:
In this line:
SET @strSQL1 = N'SELECT tbl_ICLExtCashLetter.Image_Path from tbl_ICLExtCashLetter INNER JOIN tbl_ICLExtFile on [tbl_ICLExtCashLetter].ICLExtFileUID
= [tbl_ICLExtFile].ICLExtFileUID where tbl_ICLExtFile.FileName = @FileName'
you have included the @FileName paramter inside the dynamic sql, when it executes it won't know where the parameter was declared, @strSql1 is unaware of the fact that the @FileName is being passed to the stored procedure as a parameter. Anyway, you need to add the value that @FileName parameter contains to @strSql1, like this:
SET @strSQL1 = N'SELECT tbl_ICLExtCashLetter.Image_Path from tbl_ICLExtCashLetter INNER JOIN tbl_ICLExtFile on [tbl_ICLExtCashLetter].ICLExtFileUID
= [tbl_ICLExtFile].ICLExtFileUID where tbl_ICLExtFile.FileName = '+@FileName
if it gives a syntax error, try casting @FileName as varchar in this statement.
Hope it helps, good luck.
Azee...