Words order when asking a question in a complex sentence
I'm having trouble to decide which word order to use in this sentence:
So the question is if I am to modify the programme in what environment I should do it.
Is it correct or do I need to change the last part to in what environment should I do it?
I think you just need to swap the places of "I" and "Should".
So, your sentence could be
So, the question is, if I am to modify the program, in what environment should I do it?
You have two options, a direct question and an indirect question. Both are correct, but they should not be mixed.
So the question is: "in what environment should I do it?" (direct)
So the question is in what environment I should do it. (indirect)
In the direct question, you literally pose the question in the exact same words you would use if you actually asked someone the question; in direct questions, subject and finite verb are reversed so that you get finite verb — subject
("should I").
The question mark is required; the quotation marks are not required (in your example I'd remove them); instead of the colon, you could use a comma (probably better in your example). Then you get n0nChun's version, which I agree is probably the best choice.
In the indirect question, you make the question subordinate to the main clause of the sentence, so that it isn't a literal question any more, and you use the regular order of subject — finite verb
("I should").
The question mark should not be used.