How about posting the code for the stored procedures which are called from this one?
There's nothing in this stored procedure related to importing a flat file - how have you determined that it is this stored procedure which is causing the problem?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden