The info you are looking for should be in the registry. the following SQL code reads the registry and returns the value for the SQL Code path and SQL data path. This is on SQL7, the same principal works on SQL2K but you may have to change the keys.
Declare @Instpath varchar(50), @Datapath varchar(50)
exec master.dbo.xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key='SOFTWARE\Microsoft\MSSQLServer\Setup',
@value_name='SQLPath',@value=@Instpath output
print @Instpath
exec master.dbo.xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key='SOFTWARE\Microsoft\MSSQLServer\Setup',
@value_name='SQLDataRoot',@value=@Datapath output
print @Datapath