The best way to do this would be to use variables in your stored proc
instead of
insert into table1 (query)
values('select replace('select * from table 2 where something in ('a', 'b', 'c')', ''', ''))
try putting your values into variables
declare @ValueA varchar(20)
declare @ValueB varchar(20)
declare @ValueC varchar(20)
Insert into Table2
values (@ValueA, @ValueB, @ValueC)
use the variables as input parameters for your stored procedure and this should solve your problem