• Have a look at this:

    http://www.sqlservercentral.com/blogs/practicalsqldba/2012/03/15/importing-images-to-sql-server-database-using-t-sql/

    In your case, you may want to adapt it slightly to match your KeyID with image name, but it should get you started.

    Also check if you can implement a SSIS solution instead.

    Also refer to forum post:

    http://www.sqlservercentral.com/Forums/Topic1066764-391-1.aspx

    HTH,

    B